'use strict';

angular.module('myApp.teach_leave', [])

.controller('teach_leaveCtrl', ['$scope','$http',
    function($scope,$http) {

    $scope.submit = function(leave){   
        $scope.tem = angular.copy(leave);
        console.log($scope.tem);
        $http.post('v1/teacher/'+ kget('id')+'/ask_for_leave',$scope.tem).success(function(data){
            if( !data.error ){
                alert("申请成功","success");
                window.location.href = '#/teach_leave_old';
            }else{
                alert(data.message);
            }
        });
    };
   
    $http.get('v1/school').success(function(data){
        $scope.nodel = data.result['data'];
         // console.log($scope.model);
    });
    $http.get('v1/classes').success(function(data){
    $scope.model = data.result['data'];
     // console.log($scope.model);
	});
    $http.get('v1/teacher').success(function(data){
    $scope.todel = data.result['data'];
     // console.log($scope.model);
	});

   $('.form-datetime').datetimepicker(
    {
        language:  'zh-CN',
        weekStart: 1,
        todayBtn:  1,
        autoclose: 1,
        todayHighlight: 1,
        startView: 2,
        forceParse: 0,
        showMeridian: 1,
        format: 'yyyy-mm-dd hh:ii'
    });
}]);